﻿namespace HuwmanCode

open System

[<AutoOpen>]
[<RequireQualifiedAccess>]
module Seq =
    let fromGraph (accessor:'a->'a) (obj:'a) =
        let rec gen (o:'a) =
            seq { match o with
                  | null -> yield! seq []
                  | r -> yield r
                         yield! gen (accessor r)  }
        gen obj